<?php

	require('jacked_configVars.php');
	require('jacked_configpdnet.php');
	require('jacked_functions.php');
    require('jacked_pdnetfunctions.php');
	
	header('Content-type: application/atom+xml');
	

	echo '<?xml version="1.0" encoding="UTF-8"?>';
?>

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PoorDecisions.net</title>
	<atom:link href="http://poordecisions.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://poordecisions.net</link>
	<description>There&#039;s a time and place for everything. That time is college.</description>
	<lastBuildDate><?php echo date(DATE_RFC822); ?></lastBuildDate>

	<generator>http://jackedmanager.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<?php
			$posts = getPosts(10);
			
			foreach($posts as $post){
				$tags = $post['tags'];
		?>
			
		<item>
			<title></title>
			<link>http://poordecisions.net/pd/<?php echo $post['id']; ?></link>

			<comments>http://poordecisions.net/pd/<?php echo $post['id']; ?>#comments</comments>
			<pubDate><?php echo date(DATE_RFC822, $post['date']); ?></pubDate>
			
			<?php
				foreach($tags as $tag){
			?>
			<category><![CDATA[<?php echo $tag['name']; ?>]]></category>
			<?php
				}
			?>
			<guid isPermaLink="true">http://poordecisions.net/pd/<?php echo $post['id']; ?></guid>
			
			<description><![CDATA[<?php echo $post['decision']; ?> Resulted in: <?php echo $post['result']; ?>
	]]></description>
			
			<content:encoded><![CDATA[<p><?php echo $post['decision']; ?> Resulted in: <?php echo $post['result']; ?></p>
	]]></content:encoded>

			<slash:comments><?php echo getCommentsCountForPost($post['id']); ?></slash:comments>
		</item>
		<?
			}
		?>
	</channel>
</rss>